<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			
		</style>
	</head>
	<body>
		<h1>Shopping:</h1>
		<p id="p"></p>
		<ul class="list">
		</ul>
		<script type="text/javascript" src="cookie.js" charset="UTF-8"></script>
		<script type="text/javascript">
			var xkl4 = new XMLHttpRequest();
						        var url =`http://jx.xuzhixiang.top/ap/api/cart-list.php?id=1`;
						        xkl4.open('get',url);
						        xkl4.send(null);
							    xkl4.onload = function(){
							    if(xkl4.status == 200){
								console.log(xkl4.responseText);
								var obj1 = JSON.parse(xkl4.responseText);
							    console.log(obj1);
							    }
					var html = '';
				   for(var i = 0; i < obj1.data.length; i++) {
						var productObj = obj1.data[i];
						console.log(productObj);
						html += `
					<li>
						<a aid="${productObj.pid}" class='crf' href='productList.html?${productObj.pid}'><h2>${productObj.pname}</h2></a>
						<img src="${productObj.pimg}"/>
						<p>${productObj.pprice}</p>
					</li>		
					`;
					}
				   var list = document.querySelector('.list');
				   list.innerHTML += html;
			}
		</script>
	</body>
</html>
